<template>
  <div class="rightBodyContent">
    <div class="rightBodyContent-in">
      <div class="home-container">
        <div class="wrap" ref="editor" v-loading="loading"
             element-loading-text="拼命加载中"
             element-loading-spinner="el-icon-loading"
             element-loading-background="rgba(0, 0, 0, 0.5)">
          <div>
            <el-row :gutter="20">
              <el-col :span="12">
                <div class="chart-item sub-chart-item">
                  <div class="sub-content">
                    <div class="sub-title ">
                      总预约
                      <div style="float:right;font-size: 14px;cursor:pointer;" @click="initfn">刷新
                      </div>
                    </div>
                    <div class=" sub-body sub-card">
                      <div class="sub-with-order">
                        <div class="sub-money">
                          {{ come_number }}
                        </div>
                        <div class="sub-name">总数/学期</div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="chart-item sub-chart-item">
                  <div class="sub-content">
                    <div class="sub-title ">
                      来访总数
                      <!--                      <div style="float:right;font-size: 14px;cursor:pointer;">查看-->
                      <!--                      </div>-->
                    </div>
                    <div class=" sub-body sub-card">
                      <div class="sub-with-order">
                        <div class="sub-money">
                          {{ visit_number }}
                        </div>
                        <div class="sub-name">总数/学期</div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="mt-20">
              <el-col :span="24">
                <div class="chart-item sub-chart-item">
                  <div class="sub-content">
                    <div class="sub-title mb-20">受访排行</div>
                    <div class="sub-body">
                      <el-row :gutter="10" class="mt-20">
                        <el-col :span="12" v-for="(item,index) in list">
                          <div class="chart-item chart-item-list">
                            <i>{{ index + 1 }}·</i>
                            <div class="chart-item-title">{{ item.users ? item.users.realname : '' }}</div>
                            <div class="chart-item-count">{{ item.number }}</div>
                          </div>
                        </el-col>
                      </el-row>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {admissionBoard} from "@/api/admin/system"

export default {
  name: "dataBoard",
  data() {
    return {
      list: [],
      come_number: 0,
      visit_number: 0,
      loading: true
    }
  },
  created() {
    this.initfn()
  },
  methods: {
    initfn() {
      let that = this
      this.loading = true
      admissionBoard().then(res => {
        console.log('shujj', res)
        this.list = res.list
        this.come_number = res.come_number
        this.visit_number = res.visit_number
        setTimeout(() => {
          that.loading = false
        }, 800)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.home-container {
  width: 100%;
  height: 100%;

  .wrap {
    //background: url(@/assets/imageAdmin/bg.png) no-repeat ;
    //background-size: 100%;
    //background-position: 50% 0;
    //background-color: rgb(0, 0, 0);
    width: 100%;
    height: 100%;
    padding: 20px;
  }
}

%sub-chart-item-before {
  content: "";
  position: absolute;
  top: -2px;
  width: 10px;
  height: 10px;
  border-color: #e2b353;
  border-style: solid;
  border-top-width: 2px;
  border-bottom-width: 0;
}

.sub-chart-item {
  position: relative;
  padding: 10px;
  border: 2px solid rgba(255, 179, 92, 0.1);
  //background: rgba(230, 162, 69, 0.03) url(@/assets/imageAdmin/wg.png) repeat 50% 50% !important;
  background-blend-mode: screen;
  overflow: visible;

  &:before {
    @extend %sub-chart-item-before;
    left: -2px;
    border-left-width: 2px;
    border-right-width: 0;
  }

  &:after {
    @extend %sub-chart-item-before;
    right: -2px;
    border-left-width: 0;
    border-right-width: 2px;
  }

  %sub-content-before {
    content: "";
    position: absolute;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border-color: #e2b353;
    border-style: solid;
    border-top-width: 0;
    border-bottom-width: 2px;
  }

  .sub-content {
    width: 100%;
    height: 100%;

    .sub-title {
      position: relative;
      height: 26px;
      font-size: 20px;
      color: #000;
      line-height: 26px;
      padding: 0 0 0 20px;

      &:before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        margin-top: -7px;
        width: 14px;
        height: 14px;
        //background: url(@/assets/imageAdmin/index.png) no-repeat 0% 0%;
      }
    }

    &:before {
      @extend %sub-content-before;
      left: -2px;
      border-left-width: 2px;
      border-right-width: 0;
    }

    &:after {
      @extend %sub-content-before;
      right: -2px;
      border-left-width: 0;
      border-right-width: 2px;
    }

    .sub-body {
    }

  }
}

.sub-card {
  display: flex;
}

.sub-with-order {
  width: 100%;

  .sub-money {
    height: 55px;
    font-size: 44px;
    font-weight: bold;
    color: #ff850c;
    text-align: center;
  }

  .sub-name {
    font-size: 16px;
    font-weight: bold;
    color: #3a3a3a;
    text-align: center;
  }
}

.sub-with-money {
  width: 60%;

  .sub-money {
    font-weight: bold;
    color: #f3ba82;
    position: relative;
    text-align: center;
    height: 55px;
    font-size: 40px;
    font-family: 'DIGITALDREAMFAT';
    font-weight: bold;
  }

  .sub-name {
    font-size: 23px;
    font-weight: bold;
    color: #3a3a3a;
    text-align: center;
  }
}

.sub-chart-item {

  .order-qty {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 600;
    margin-left: 20px;
    margin-top: 10px;

    span {
      font-size: 26px;
      margin-left: 10px;
    }
  }

  .amount-text {
    width: 125px;
    color: #FFFFFF;
    margin-left: 20px;
    margin-top: 20px;
    font-size: 23px;
    margin-right: 10px;
    font-weight: 600;
  }

  .amount-unit {
    color: #FFFFFF;
    margin-left: 10px;
    font-size: 18px;
    width: 100px;
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
  }
}

.chart-item-list {
  display: flex;
  color: #000;
  padding: 10px 30px 10px 10px;
  font-size: 16px;
  background: #0760c312;
  margin-bottom: 5px;
  border-radius: 10px;
}

.chart-item-list i {
  font-size: 18px;
  font-style: normal;
  display: block;
  width: 40px;
  text-align: right;
  margin-right: 10px;
  color: #ff9100;
  font-weight: bold;
}

.chart-item-title {
  flex: 1;
}

.chart-item-count {

}
</style>
